// 分页组件
import Pagination from '@/components/Pagination'

// 自定义表格工具组件
import RightToolbar from '@/components/RightToolbar'

// 文件上传组件
import FileUpload from '@/components/FileUpload'

// 文件下载组件
import DownloadFile from '@/components/XiaoheComponents/downloadFile'

// 图片上传组件
import ImageUpload from '@/components/ImageUpload'

// 图片预览组件
import ImagePreview from '@/components/ImagePreview'

// 自定义树选择组件
import TreeSelect from '@/components/TreeSelect'

// 字典标签组件
import DictTag from '@/components/DictTag'

// 查询条件
import SelectForm from '@/components/XiaoheComponents/XiaoheSelect'

// 弹窗
import XiaoheDialog from '@/components/XiaoheComponents/XiaoheDialog'

// 开关组件
import Switch from '@/components/XiaoheComponents/system/switch'

// 审核历史
import AuditHistory from '@/components/XiaoheComponents/system/auditHistory'

// 标签
import Tag from '@/components/XiaoheComponents/system/tap'

// 关结
import Closing from '@/components/XiaoheComponents/system/closing'

// 物料选择(有类别)
import Material from '@/components/XiaoheComponents/material'

// Bom列表
import Bom from '@/components/XiaoheComponents/material/bom'

// 单据配置下拉
import BillConfig from '@/components/XiaoheComponents/billConfig'

// 多级选择
import Cascader from '@/components/XiaoheComponents/cascader'

// 供应商
import Supplier from '@/components/XiaoheComponents/order/supplier'

// 客户信息
import Customer from '@/components/XiaoheComponents/order/customer'

// 加工商信息
import Converter from '@/components/XiaoheComponents/order/converter/index'

// 保存按钮
import Btn from '@/components/XiaoheComponents/Btn'

// 仓库交接组件
import Handover from '@/components/XiaoheComponents/storage/handover'

// 仓库入库组件
import Warehousing from '@/components/XiaoheComponents/storage/warehousing'

// 仓库出库组件
import Outwareousing from '@/components/XiaoheComponents/storage/outwareousing'

// 制令单号组件
import Product from '@/components/XiaoheComponents/productionTube/product'

import XiaoheImg from '@/components/XiaoheComponents/system/img'

// 自动寻找字典
import xhTree from '@/components/XiaoheComponents/xhTree'

// 线别下拉组件
import SelLine from '@/components/XiaoheComponents/productionTube/selLine'

// 实时通讯
import webSocket from '@/utils/webSocket/index'

// 打印预览
import PrintView from '@/components/XiaoheComponents/printView'

// 自动寻找字典
import XiaoheDictTag from '@/components/XiaoheComponents/system/dictTag'

// echarts
import Echarts from '@/components/XiaoheComponents/echarts'

// 个人方法
import funComm from '@/utils/funComm.js'
import { useDict } from '@/utils/dict'
import { download, downloadPdf } from '@/utils/request'
import { parseTime, resetForm, addDateRange, handleTree, selectDictLabel, selectDictLabels } from '@/utils/ruoyi'
// 阿里图标
import Icon from '@/components/XiaoheComponents/system/aliCcon'

// 导入组件
import Impoer from '@/components/XiaoheComponents/impoer'
const inall = app => {
  app.component('XiaoheDictTag', XiaoheDictTag)
  app.component('DictTag', DictTag)
  app.component('Pagination', Pagination)
  app.component('TreeSelect', TreeSelect)
  app.component('FileUpload', FileUpload)
  app.component('DownloadFile', DownloadFile)
  app.component('ImageUpload', ImageUpload)
  app.component('ImagePreview', ImagePreview)
  app.component('RightToolbar', RightToolbar)
  app.component('SelectForm', SelectForm)
  app.component('Material', Material)
  app.component('Bom', Bom)
  app.component('Closing', Closing)
  app.component('BillConfig', BillConfig)
  app.component('AuditHistory', AuditHistory)
  app.component('Cascader', Cascader)
  app.component('Supplier', Supplier)
  app.component('Customer', Customer)
  app.component('Converter', Converter)
  app.component('Btn', Btn)
  app.component('Handover', Handover)
  app.component('Warehousing', Warehousing)
  app.component('Outwareousing', Outwareousing)
  app.component('Product', Product)
  app.component('XiaoheImg', XiaoheImg)
  app.component('PrintView', PrintView)
  app.component('SelLine', SelLine)
  app.component('Echarts', Echarts)
  app.component('XiaoheIcon', Icon)
  app.component('xh-tree', xhTree)
  app.component('p-XiaoheDialog', XiaoheDialog)
  // app.component('p-XiaoheDialog', XiaoheDialog)
  app.component('p-tag', Tag)
  app.component('p-switch', Switch)
  app.component('p-impoer', Impoer)

  /**
   * ----------------------------SRT------------------------------->
   * components/p-components/order
   * 读取基础本地文件
   * 挂载基础组件
   */
  // 读取本地文件（基础）
  const components = import.meta.glob('@/components/p-components/*/index.vue')
  // 底层组件
  for (const [key, value] of Object.entries(components)) {
    const keyName = key.split('/')[key.split('/').length - 2]
    app.component(keyName, defineAsyncComponent(value))
  }
  // ----------------------------END------------------------------->

  // 全局方法挂载
  app.config.globalProperties.useDict = useDict
  app.config.globalProperties.download = download
  app.config.globalProperties.downloadPdf = downloadPdf
  app.config.globalProperties.parseTime = parseTime
  app.config.globalProperties.resetForm = resetForm
  app.config.globalProperties.handleTree = handleTree
  app.config.globalProperties.addDateRange = addDateRange
  app.config.globalProperties.selectDictLabel = selectDictLabel
  app.config.globalProperties.selectDictLabels = selectDictLabels
  app.config.globalProperties.webSocket = webSocket

  // 个人全局方法挂在
  for (let KEY in funComm) {
    app.config.globalProperties[KEY] = funComm[KEY]
  }
}

export default inall
